package com.vcms.cms.entity;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user", catalog = "vcms_0.1")
public class User implements java.io.Serializable {

	// Fields

	private Integer userId;
	private String userName;
	private String email;
	private Timestamp registerTime;
	private String registerIp;
	private Timestamp lastLoginTime;
	private String lastLoginIp;
	private Integer loginCount;
	private Integer uploadTotal;
	private Integer uploadSize;
	private Boolean isAdmin;
	private Boolean isViewOnlyAdmin;
	private Boolean isSelfAdmin;
	private Boolean isDisabled;
	private String realName;
	private Date birthday;
	private String intro;
	private String address;
	private String qq;
	private String msn;
	private String phone;
	private String photo;
	private String signature;
	private Set<Guestbook> guestbooks = new HashSet<Guestbook>(0);
	private Set<Comment> commentsForUseUserId = new HashSet<Comment>(0);
	private Set<Role> roles = new HashSet<Role>(0);
	private Set<Comment> commentsForUserId = new HashSet<Comment>(0);
	private Set<VoteRecord> voteRecords = new HashSet<VoteRecord>(0);
	private Set<Content> contents = new HashSet<Content>(0);
	private Set<ContentCheck> contentChecks = new HashSet<ContentCheck>(0);
	private Set<Channel> channels = new HashSet<Channel>(0);
	private Set<UserSite> userSites = new HashSet<UserSite>(0);

	// Constructors

	/** default constructor */
	public User() {
	}

	/** full constructor */
	public User(String userName, String email, Timestamp registerTime,
			String registerIp, Timestamp lastLoginTime, String lastLoginIp,
			Integer loginCount, Integer uploadTotal, Integer uploadSize,
			Boolean isAdmin, Boolean isViewOnlyAdmin, Boolean isSelfAdmin,
			Boolean isDisabled, String realName, Date birthday, String intro,
			String address, String qq, String msn, String phone, String photo,
			String signature, Set<Guestbook> guestbooks,
			Set<Comment> commentsForUseUserId, Set<Role> roles,
			Set<Comment> commentsForUserId, Set<VoteRecord> voteRecords,
			Set<Content> contents, Set<ContentCheck> contentChecks,
			Set<Channel> channels, Set<UserSite> userSites) {
		this.userName = userName;
		this.email = email;
		this.registerTime = registerTime;
		this.registerIp = registerIp;
		this.lastLoginTime = lastLoginTime;
		this.lastLoginIp = lastLoginIp;
		this.loginCount = loginCount;
		this.uploadTotal = uploadTotal;
		this.uploadSize = uploadSize;
		this.isAdmin = isAdmin;
		this.isViewOnlyAdmin = isViewOnlyAdmin;
		this.isSelfAdmin = isSelfAdmin;
		this.isDisabled = isDisabled;
		this.realName = realName;
		this.birthday = birthday;
		this.intro = intro;
		this.address = address;
		this.qq = qq;
		this.msn = msn;
		this.phone = phone;
		this.photo = photo;
		this.signature = signature;
		this.guestbooks = guestbooks;
		this.commentsForUseUserId = commentsForUseUserId;
		this.roles = roles;
		this.commentsForUserId = commentsForUserId;
		this.voteRecords = voteRecords;
		this.contents = contents;
		this.contentChecks = contentChecks;
		this.channels = channels;
		this.userSites = userSites;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "userId", unique = true, nullable = false)
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "userName", length = 200)
	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "email", length = 100)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "registerTime", length = 19)
	public Timestamp getRegisterTime() {
		return this.registerTime;
	}

	public void setRegisterTime(Timestamp registerTime) {
		this.registerTime = registerTime;
	}

	@Column(name = "registerIp", length = 100)
	public String getRegisterIp() {
		return this.registerIp;
	}

	public void setRegisterIp(String registerIp) {
		this.registerIp = registerIp;
	}

	@Column(name = "lastLoginTime", length = 19)
	public Timestamp getLastLoginTime() {
		return this.lastLoginTime;
	}

	public void setLastLoginTime(Timestamp lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	@Column(name = "lastLoginIp", length = 100)
	public String getLastLoginIp() {
		return this.lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	@Column(name = "loginCount")
	public Integer getLoginCount() {
		return this.loginCount;
	}

	public void setLoginCount(Integer loginCount) {
		this.loginCount = loginCount;
	}

	@Column(name = "uploadTotal")
	public Integer getUploadTotal() {
		return this.uploadTotal;
	}

	public void setUploadTotal(Integer uploadTotal) {
		this.uploadTotal = uploadTotal;
	}

	@Column(name = "uploadSize")
	public Integer getUploadSize() {
		return this.uploadSize;
	}

	public void setUploadSize(Integer uploadSize) {
		this.uploadSize = uploadSize;
	}

	@Column(name = "isAdmin")
	public Boolean getIsAdmin() {
		return this.isAdmin;
	}

	public void setIsAdmin(Boolean isAdmin) {
		this.isAdmin = isAdmin;
	}

	@Column(name = "isViewOnlyAdmin")
	public Boolean getIsViewOnlyAdmin() {
		return this.isViewOnlyAdmin;
	}

	public void setIsViewOnlyAdmin(Boolean isViewOnlyAdmin) {
		this.isViewOnlyAdmin = isViewOnlyAdmin;
	}

	@Column(name = "isSelfAdmin")
	public Boolean getIsSelfAdmin() {
		return this.isSelfAdmin;
	}

	public void setIsSelfAdmin(Boolean isSelfAdmin) {
		this.isSelfAdmin = isSelfAdmin;
	}

	@Column(name = "isDisabled")
	public Boolean getIsDisabled() {
		return this.isDisabled;
	}

	public void setIsDisabled(Boolean isDisabled) {
		this.isDisabled = isDisabled;
	}

	@Column(name = "realName", length = 200)
	public String getRealName() {
		return this.realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "birthday", length = 10)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "intro", length = 500)
	public String getIntro() {
		return this.intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	@Column(name = "address", length = 100)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "qq", length = 20)
	public String getQq() {
		return this.qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	@Column(name = "msn", length = 50)
	public String getMsn() {
		return this.msn;
	}

	public void setMsn(String msn) {
		this.msn = msn;
	}

	@Column(name = "phone", length = 20)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "photo", length = 300)
	public String getPhoto() {
		return this.photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	@Column(name = "signature", length = 300)
	public String getSignature() {
		return this.signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Guestbook> getGuestbooks() {
		return this.guestbooks;
	}

	public void setGuestbooks(Set<Guestbook> guestbooks) {
		this.guestbooks = guestbooks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "userByUseUserId")
	public Set<Comment> getCommentsForUseUserId() {
		return this.commentsForUseUserId;
	}

	public void setCommentsForUseUserId(Set<Comment> commentsForUseUserId) {
		this.commentsForUseUserId = commentsForUseUserId;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "usere_role", catalog = "vcms_0.1", joinColumns = { @JoinColumn(name = "userId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "roleId", nullable = false, updatable = false) })
	public Set<Role> getRoles() {
		return this.roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "userByUserId")
	public Set<Comment> getCommentsForUserId() {
		return this.commentsForUserId;
	}

	public void setCommentsForUserId(Set<Comment> commentsForUserId) {
		this.commentsForUserId = commentsForUserId;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<VoteRecord> getVoteRecords() {
		return this.voteRecords;
	}

	public void setVoteRecords(Set<VoteRecord> voteRecords) {
		this.voteRecords = voteRecords;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Content> getContents() {
		return this.contents;
	}

	public void setContents(Set<Content> contents) {
		this.contents = contents;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<ContentCheck> getContentChecks() {
		return this.contentChecks;
	}

	public void setContentChecks(Set<ContentCheck> contentChecks) {
		this.contentChecks = contentChecks;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "channel_user", catalog = "vcms_0.1", joinColumns = { @JoinColumn(name = "userId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "channelId", nullable = false, updatable = false) })
	public Set<Channel> getChannels() {
		return this.channels;
	}

	public void setChannels(Set<Channel> channels) {
		this.channels = channels;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<UserSite> getUserSites() {
		return this.userSites;
	}

	public void setUserSites(Set<UserSite> userSites) {
		this.userSites = userSites;
	}

}